
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, 2012 and Azure
-- --------------------------------------------------
-- Date Created: 05/29/2021 10:06:06
-- Generated from EDMX file: E:\source\repos\Yyyg.WebUI\Yyyg.Models\LuckyEntity.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [Lucky];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_Bill_Member]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Bill] DROP CONSTRAINT [FK_Bill_Member];
GO
IF OBJECT_ID(N'[dbo].[FK_Bill_TradChannels]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Bill] DROP CONSTRAINT [FK_Bill_TradChannels];
GO
IF OBJECT_ID(N'[dbo].[FK_Comment_Sun]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Comment] DROP CONSTRAINT [FK_Comment_Sun];
GO
IF OBJECT_ID(N'[dbo].[FK_Goods_Goods_type]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Goods] DROP CONSTRAINT [FK_Goods_Goods_type];
GO
IF OBJECT_ID(N'[dbo].[FK_Orders_Member]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Orders] DROP CONSTRAINT [FK_Orders_Member];
GO
IF OBJECT_ID(N'[dbo].[FK_Orders_ReceInfo]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Orders] DROP CONSTRAINT [FK_Orders_ReceInfo];
GO
IF OBJECT_ID(N'[dbo].[FK_Orders_Rushby_all]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Orders] DROP CONSTRAINT [FK_Orders_Rushby_all];
GO
IF OBJECT_ID(N'[dbo].[FK_ReceInfo_Member]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ReceInfo] DROP CONSTRAINT [FK_ReceInfo_Member];
GO
IF OBJECT_ID(N'[dbo].[FK_Rushby_all_Goods]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Rushby_all] DROP CONSTRAINT [FK_Rushby_all_Goods];
GO
IF OBJECT_ID(N'[dbo].[FK_Rushby_det_Rushby_all]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Rushby_det] DROP CONSTRAINT [FK_Rushby_det_Rushby_all];
GO
IF OBJECT_ID(N'[dbo].[FK_Rushby_now_Rushby_all]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Rushby_now] DROP CONSTRAINT [FK_Rushby_now_Rushby_all];
GO
IF OBJECT_ID(N'[dbo].[FK_Rushby_over_Member]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Rushby_over] DROP CONSTRAINT [FK_Rushby_over_Member];
GO
IF OBJECT_ID(N'[dbo].[FK_Rushby_over_Rushby_all]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Rushby_over] DROP CONSTRAINT [FK_Rushby_over_Rushby_all];
GO
IF OBJECT_ID(N'[dbo].[FK_Sun_Rushby_over]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Sun] DROP CONSTRAINT [FK_Sun_Rushby_over];
GO

-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[Admins]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Admins];
GO
IF OBJECT_ID(N'[dbo].[Bill]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Bill];
GO
IF OBJECT_ID(N'[dbo].[Comment]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Comment];
GO
IF OBJECT_ID(N'[dbo].[Goods]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Goods];
GO
IF OBJECT_ID(N'[dbo].[Goods_type]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Goods_type];
GO
IF OBJECT_ID(N'[dbo].[Member]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Member];
GO
IF OBJECT_ID(N'[dbo].[Orders]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Orders];
GO
IF OBJECT_ID(N'[dbo].[ReceInfo]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ReceInfo];
GO
IF OBJECT_ID(N'[dbo].[Region]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Region];
GO
IF OBJECT_ID(N'[dbo].[Rushby_all]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Rushby_all];
GO
IF OBJECT_ID(N'[dbo].[Rushby_det]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Rushby_det];
GO
IF OBJECT_ID(N'[dbo].[Rushby_now]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Rushby_now];
GO
IF OBJECT_ID(N'[dbo].[Rushby_over]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Rushby_over];
GO
IF OBJECT_ID(N'[dbo].[Sun]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Sun];
GO
IF OBJECT_ID(N'[dbo].[TradChannels]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TradChannels];
GO
IF OBJECT_ID(N'[LuckyModelStoreContainer].[View_GoodOrType]', 'U') IS NOT NULL
    DROP TABLE [LuckyModelStoreContainer].[View_GoodOrType];
GO

-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'Admins'
CREATE TABLE [dbo].[Admins] (
    [Uid] int IDENTITY(1,1) NOT NULL,
    [Mobile] char(11)  NULL,
    [Pwd] char(20)  NOT NULL,
    [Uname] nvarchar(20)  NOT NULL,
    [Limit] int  NOT NULL
);
GO

-- Creating table 'Comment'
CREATE TABLE [dbo].[Comment] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Sun_id] int  NOT NULL,
    [Uid] int  NOT NULL,
    [Content] nvarchar(200)  NOT NULL,
    [Fav_count] int  NOT NULL,
    [Createtime] datetime  NOT NULL
);
GO

-- Creating table 'Goods'
CREATE TABLE [dbo].[Goods] (
    [Gid] int IDENTITY(1,1) NOT NULL,
    [Guid] nchar(32)  NOT NULL,
    [Title] nvarchar(200)  NOT NULL,
    [Price] decimal(19,4)  NOT NULL,
    [Typeid] int  NOT NULL,
    [Need_amo] int  NOT NULL,
    [Stock] int  NOT NULL,
    [Mainimg_url] varchar(50)  NULL,
    [Subimgs_url] varchar(max)  NULL,
    [Detimgs_url] varchar(max)  NULL,
    [Brin] varchar(max)  NULL,
    [Enable] bit  NOT NULL
);
GO

-- Creating table 'Goods_type'
CREATE TABLE [dbo].[Goods_type] (
    [Typeid] int IDENTITY(1,1) NOT NULL,
    [Parentid] int  NOT NULL,
    [Typename] nvarchar(50)  NOT NULL
);
GO

-- Creating table 'ReceInfo'
CREATE TABLE [dbo].[ReceInfo] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Uid] int  NOT NULL,
    [Proe] nvarchar(20)  NOT NULL,
    [City] nvarchar(20)  NOT NULL,
    [Area] nvarchar(20)  NOT NULL,
    [Det] nvarchar(200)  NOT NULL,
    [Mobile] char(11)  NOT NULL,
    [Consianee] nvarchar(20)  NOT NULL,
    [IsDefault] bit  NOT NULL
);
GO

-- Creating table 'Rushby_all'
CREATE TABLE [dbo].[Rushby_all] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Per_num] int  NOT NULL,
    [Gid] int  NOT NULL,
    [Winuid] int  NULL,
    [All_told] int  NOT NULL,
    [Rem] int  NOT NULL,
    [Bt_price] int  NOT NULL,
    [Status] int  NOT NULL,
    [Createtime] datetime  NOT NULL
);
GO

-- Creating table 'Rushby_now'
CREATE TABLE [dbo].[Rushby_now] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Gid] int  NOT NULL,
    [Rush_id] int  NOT NULL
);
GO

-- Creating table 'Sun'
CREATE TABLE [dbo].[Sun] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Uid] int  NOT NULL,
    [Rushby_over_id] int  NOT NULL,
    [Title] nvarchar(200)  NOT NULL,
    [Content] varchar(max)  NOT NULL,
    [Imgs_url] varchar(max)  NOT NULL,
    [Fav_count] int  NOT NULL,
    [Createtime] datetime  NOT NULL
);
GO

-- Creating table 'Region'
CREATE TABLE [dbo].[Region] (
    [Id] char(10)  NOT NULL,
    [Name] nvarchar(50)  NOT NULL
);
GO

-- Creating table 'Rushby_det'
CREATE TABLE [dbo].[Rushby_det] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Rushid] int  NOT NULL,
    [Orderid] int  NOT NULL,
    [Uid] int  NOT NULL,
    [RobNumStart] int  NOT NULL,
    [RobNumEnd] int  NOT NULL
);
GO

-- Creating table 'Bill'
CREATE TABLE [dbo].[Bill] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Uid] int  NOT NULL,
    [Quota] int  NOT NULL,
    [Dire] int  NOT NULL,
    [Channel] int  NOT NULL,
    [CreateTime] datetime  NOT NULL
);
GO

-- Creating table 'TradChannels'
CREATE TABLE [dbo].[TradChannels] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [ChanName] nvarchar(20)  NOT NULL
);
GO

-- Creating table 'Orders'
CREATE TABLE [dbo].[Orders] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Uid] int  NOT NULL,
    [Receid] int  NOT NULL,
    [Rush_id] int  NOT NULL,
    [Payment] decimal(19,4)  NOT NULL,
    [Status] int  NOT NULL,
    [Bycount] int  NOT NULL,
    [Createtime] datetime  NOT NULL
);
GO

-- Creating table 'Member'
CREATE TABLE [dbo].[Member] (
    [Uid] int IDENTITY(1,1) NOT NULL,
    [Petname] nvarchar(20)  NOT NULL,
    [Sex] nvarchar(1)  NOT NULL,
    [Mobile] char(11)  NOT NULL,
    [Email] nvarchar(100)  NULL,
    [Pwd] varchar(50)  NOT NULL,
    [Acbal] int  NOT NULL,
    [Createtime] datetime  NOT NULL
);
GO

-- Creating table 'View_GoodOrType'
CREATE TABLE [dbo].[View_GoodOrType] (
    [typeid] int  NOT NULL,
    [guid] nchar(130)  NOT NULL,
    [title] nvarchar(200)  NOT NULL,
    [price] decimal(19,4)  NOT NULL,
    [stock] int  NOT NULL,
    [brin] varchar(max)  NULL,
    [enable] bit  NOT NULL,
    [typename] nvarchar(50)  NOT NULL,
    [gid] int  NOT NULL
);
GO

-- Creating table 'Rushby_over'
CREATE TABLE [dbo].[Rushby_over] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Rush_id] int  NOT NULL,
    [Uid] int  NOT NULL,
    [Bycount] int  NOT NULL,
    [Lott_num] int  NOT NULL,
    [BeenViewed] bit  NOT NULL,
    [TicketNum] int  NOT NULL,
    [TotalNum] int  NOT NULL,
    [Sum50] bigint  NOT NULL,
    [Createtime] datetime  NOT NULL
);
GO

-- Creating table 'UserCollect'
CREATE TABLE [dbo].[UserCollect] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Uid] int  NOT NULL,
    [Gid] int  NOT NULL,
    [CreateTime] datetime  NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [Uid] in table 'Admins'
ALTER TABLE [dbo].[Admins]
ADD CONSTRAINT [PK_Admins]
    PRIMARY KEY CLUSTERED ([Uid] ASC);
GO

-- Creating primary key on [Id] in table 'Comment'
ALTER TABLE [dbo].[Comment]
ADD CONSTRAINT [PK_Comment]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Gid] in table 'Goods'
ALTER TABLE [dbo].[Goods]
ADD CONSTRAINT [PK_Goods]
    PRIMARY KEY CLUSTERED ([Gid] ASC);
GO

-- Creating primary key on [Typeid] in table 'Goods_type'
ALTER TABLE [dbo].[Goods_type]
ADD CONSTRAINT [PK_Goods_type]
    PRIMARY KEY CLUSTERED ([Typeid] ASC);
GO

-- Creating primary key on [Id] in table 'ReceInfo'
ALTER TABLE [dbo].[ReceInfo]
ADD CONSTRAINT [PK_ReceInfo]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'Rushby_all'
ALTER TABLE [dbo].[Rushby_all]
ADD CONSTRAINT [PK_Rushby_all]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'Rushby_now'
ALTER TABLE [dbo].[Rushby_now]
ADD CONSTRAINT [PK_Rushby_now]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'Sun'
ALTER TABLE [dbo].[Sun]
ADD CONSTRAINT [PK_Sun]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'Region'
ALTER TABLE [dbo].[Region]
ADD CONSTRAINT [PK_Region]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'Rushby_det'
ALTER TABLE [dbo].[Rushby_det]
ADD CONSTRAINT [PK_Rushby_det]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'Bill'
ALTER TABLE [dbo].[Bill]
ADD CONSTRAINT [PK_Bill]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'TradChannels'
ALTER TABLE [dbo].[TradChannels]
ADD CONSTRAINT [PK_TradChannels]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'Orders'
ALTER TABLE [dbo].[Orders]
ADD CONSTRAINT [PK_Orders]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Uid] in table 'Member'
ALTER TABLE [dbo].[Member]
ADD CONSTRAINT [PK_Member]
    PRIMARY KEY CLUSTERED ([Uid] ASC);
GO

-- Creating primary key on [typeid], [guid], [title], [price], [stock], [enable], [typename], [gid] in table 'View_GoodOrType'
ALTER TABLE [dbo].[View_GoodOrType]
ADD CONSTRAINT [PK_View_GoodOrType]
    PRIMARY KEY CLUSTERED ([typeid], [guid], [title], [price], [stock], [enable], [typename], [gid] ASC);
GO

-- Creating primary key on [Id] in table 'Rushby_over'
ALTER TABLE [dbo].[Rushby_over]
ADD CONSTRAINT [PK_Rushby_over]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'UserCollect'
ALTER TABLE [dbo].[UserCollect]
ADD CONSTRAINT [PK_UserCollect]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- Creating foreign key on [Sun_id] in table 'Comment'
ALTER TABLE [dbo].[Comment]
ADD CONSTRAINT [FK_Comment_Sun]
    FOREIGN KEY ([Sun_id])
    REFERENCES [dbo].[Sun]
        ([Id])
    ON DELETE CASCADE ON UPDATE NO ACTION;
GO

-- Creating non-clustered index for FOREIGN KEY 'FK_Comment_Sun'
CREATE INDEX [IX_FK_Comment_Sun]
ON [dbo].[Comment]
    ([Sun_id]);
GO

-- Creating foreign key on [Typeid] in table 'Goods'
ALTER TABLE [dbo].[Goods]
ADD CONSTRAINT [FK_Goods_Goods_type]
    FOREIGN KEY ([Typeid])
    REFERENCES [dbo].[Goods_type]
        ([Typeid])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating non-clustered index for FOREIGN KEY 'FK_Goods_Goods_type'
CREATE INDEX [IX_FK_Goods_Goods_type]
ON [dbo].[Goods]
    ([Typeid]);
GO

-- Creating foreign key on [Gid] in table 'Rushby_all'
ALTER TABLE [dbo].[Rushby_all]
ADD CONSTRAINT [FK_Rushby_all_Goods]
    FOREIGN KEY ([Gid])
    REFERENCES [dbo].[Goods]
        ([Gid])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating non-clustered index for FOREIGN KEY 'FK_Rushby_all_Goods'
CREATE INDEX [IX_FK_Rushby_all_Goods]
ON [dbo].[Rushby_all]
    ([Gid]);
GO

-- Creating foreign key on [Rush_id] in table 'Rushby_now'
ALTER TABLE [dbo].[Rushby_now]
ADD CONSTRAINT [FK_Rushby_now_Rushby_all]
    FOREIGN KEY ([Rush_id])
    REFERENCES [dbo].[Rushby_all]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating non-clustered index for FOREIGN KEY 'FK_Rushby_now_Rushby_all'
CREATE INDEX [IX_FK_Rushby_now_Rushby_all]
ON [dbo].[Rushby_now]
    ([Rush_id]);
GO

-- Creating foreign key on [Rushid] in table 'Rushby_det'
ALTER TABLE [dbo].[Rushby_det]
ADD CONSTRAINT [FK_Rushby_det_Rushby_all]
    FOREIGN KEY ([Rushid])
    REFERENCES [dbo].[Rushby_all]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating non-clustered index for FOREIGN KEY 'FK_Rushby_det_Rushby_all'
CREATE INDEX [IX_FK_Rushby_det_Rushby_all]
ON [dbo].[Rushby_det]
    ([Rushid]);
GO

-- Creating foreign key on [Channel] in table 'Bill'
ALTER TABLE [dbo].[Bill]
ADD CONSTRAINT [FK_Bill_TradChannels]
    FOREIGN KEY ([Channel])
    REFERENCES [dbo].[TradChannels]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating non-clustered index for FOREIGN KEY 'FK_Bill_TradChannels'
CREATE INDEX [IX_FK_Bill_TradChannels]
ON [dbo].[Bill]
    ([Channel]);
GO

-- Creating foreign key on [Receid] in table 'Orders'
ALTER TABLE [dbo].[Orders]
ADD CONSTRAINT [FK_Orders_ReceInfo]
    FOREIGN KEY ([Receid])
    REFERENCES [dbo].[ReceInfo]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating non-clustered index for FOREIGN KEY 'FK_Orders_ReceInfo'
CREATE INDEX [IX_FK_Orders_ReceInfo]
ON [dbo].[Orders]
    ([Receid]);
GO

-- Creating foreign key on [Rush_id] in table 'Orders'
ALTER TABLE [dbo].[Orders]
ADD CONSTRAINT [FK_Orders_Rushby_all]
    FOREIGN KEY ([Rush_id])
    REFERENCES [dbo].[Rushby_all]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating non-clustered index for FOREIGN KEY 'FK_Orders_Rushby_all'
CREATE INDEX [IX_FK_Orders_Rushby_all]
ON [dbo].[Orders]
    ([Rush_id]);
GO

-- Creating foreign key on [Uid] in table 'Bill'
ALTER TABLE [dbo].[Bill]
ADD CONSTRAINT [FK_Bill_Member]
    FOREIGN KEY ([Uid])
    REFERENCES [dbo].[Member]
        ([Uid])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating non-clustered index for FOREIGN KEY 'FK_Bill_Member'
CREATE INDEX [IX_FK_Bill_Member]
ON [dbo].[Bill]
    ([Uid]);
GO

-- Creating foreign key on [Uid] in table 'Orders'
ALTER TABLE [dbo].[Orders]
ADD CONSTRAINT [FK_Orders_Member]
    FOREIGN KEY ([Uid])
    REFERENCES [dbo].[Member]
        ([Uid])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating non-clustered index for FOREIGN KEY 'FK_Orders_Member'
CREATE INDEX [IX_FK_Orders_Member]
ON [dbo].[Orders]
    ([Uid]);
GO

-- Creating foreign key on [Uid] in table 'ReceInfo'
ALTER TABLE [dbo].[ReceInfo]
ADD CONSTRAINT [FK_ReceInfo_Member]
    FOREIGN KEY ([Uid])
    REFERENCES [dbo].[Member]
        ([Uid])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating non-clustered index for FOREIGN KEY 'FK_ReceInfo_Member'
CREATE INDEX [IX_FK_ReceInfo_Member]
ON [dbo].[ReceInfo]
    ([Uid]);
GO

-- Creating foreign key on [Uid] in table 'Rushby_over'
ALTER TABLE [dbo].[Rushby_over]
ADD CONSTRAINT [FK_Rushby_over_Member]
    FOREIGN KEY ([Uid])
    REFERENCES [dbo].[Member]
        ([Uid])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating non-clustered index for FOREIGN KEY 'FK_Rushby_over_Member'
CREATE INDEX [IX_FK_Rushby_over_Member]
ON [dbo].[Rushby_over]
    ([Uid]);
GO

-- Creating foreign key on [Rush_id] in table 'Rushby_over'
ALTER TABLE [dbo].[Rushby_over]
ADD CONSTRAINT [FK_Rushby_over_Rushby_all]
    FOREIGN KEY ([Rush_id])
    REFERENCES [dbo].[Rushby_all]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating non-clustered index for FOREIGN KEY 'FK_Rushby_over_Rushby_all'
CREATE INDEX [IX_FK_Rushby_over_Rushby_all]
ON [dbo].[Rushby_over]
    ([Rush_id]);
GO

-- Creating foreign key on [Rushby_over_id] in table 'Sun'
ALTER TABLE [dbo].[Sun]
ADD CONSTRAINT [FK_Sun_Rushby_over]
    FOREIGN KEY ([Rushby_over_id])
    REFERENCES [dbo].[Rushby_over]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating non-clustered index for FOREIGN KEY 'FK_Sun_Rushby_over'
CREATE INDEX [IX_FK_Sun_Rushby_over]
ON [dbo].[Sun]
    ([Rushby_over_id]);
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------